from selenium.webdriver.common.by import By
from common.Utils import ChatroomDriver

#联系人详情页测试
class ContactList:
    url=""
    driver=""
    def __init__(self):
        self.url = "http://127.0.0.1:8080/client.html"
        self.driver=ChatroomDriver.driver
        self.driver.get(self.url)

    #登录状态下
    def ContactTestByLogin(self):
        self.driver.find_element(By.CSS_SELECTOR, "body > div.client-container > div > div.left > div.tab > div.tab-friend").click()
        #检查元素
        #当前登录用户名
        self.driver.find_element(By.CSS_SELECTOR,"body > div.client-container > div > div.right > div.titlebody > div.client-container > div > div.left > div.user")
        # 搜索框
        self.driver.find_element(By.CSS_SELECTOR,"body > div.client-container > div > div.left > div.search > input[type=text]")
        # 搜索按钮
        self.driver.find_element(By.CSS_SELECTOR, "body > div.client-container > div > div.left > div.search > button")
        # 聊天列表按钮
        self.driver.find_element(By.CSS_SELECTOR,"body > div.client-container > div > div.left > div.tab > div.tab-session")
        # 联系人列表按钮
        self.driver.find_element(By.CSS_SELECTOR,"body > div.client-container > div > div.left > div.tab > div.tab-friend")
        #联系人姓名
        self.driver.find_element(By.CSS_SELECTOR,"#friend-list > li:nth-child(1) > h4")
        #屏幕截图
        ChatroomDriver.getScreeShot()
        self.driver.back()

# list = ContactList()
# list.ContactTestByLogin()

